package com.horay.springclouddemo.provider.member.service.impl;

import com.horay.springclouddemo.model.member.Member;
import com.horay.springclouddemo.model.member.MemberDTO;
import com.horay.springclouddemo.provider.member.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * 成员业务服务实现类
 *
 * @author heyingcheng
 * @date 2020/3/21 14:19
 */
@Slf4j
@Service
public class MemberServiceImpl implements MemberService {

    @Value("${server.port}")
    private int port;

    /**
     * 新增成员
     *
     * @param member
     * @return boolean
     * @author heyingcheng
     * @date 2020/3/21 14:17
     */
    @Override
    public boolean createMember(Member member) {
        log.info("{}.createMember, port:[{}], member:[{}]", this.getClass().getName(), port, member);
        return true;
    }

    /**
     * 获取成员
     *
     * @param id
     * @return com.horay.springclouddemo.provider.member.model.Member
     * @author heyingcheng
     * @date 2020/3/21 14:17
     */
    @Override
    public Member getMember(Integer id) {
        log.info("{}.getMember, port:[{}], id:[{}]", this.getClass().getName(), port, id);
        return new Member(id);
    }

    /**
     * 获取成员集合
     *
     * @param memberDTO
     * @return java.util.List<com.horay.springclouddemo.provider.member.model.Member>
     * @author heyingcheng
     * @date 2020/3/21 14:18
     */
    @Override
    public List<Member> getMembers(MemberDTO memberDTO) {
        log.info("{}.getMembers, port:[{}], memberDTO:[{}]", this.getClass().getName(), port, memberDTO);
        return Collections.emptyList();
    }

    /**
     * 更新成员
     *
     * @param member
     * @return boolean
     * @author heyingcheng
     * @date 2020/3/21 14:18
     */
    @Override
    public boolean updateMember(Member member) {
        log.info("{}.updateMember, port:[{}], member:[{}]", this.getClass().getName(), port, member);
        return true;
    }

    /**
     * 删除成员
     *
     * @param id
     * @return boolean
     * @author heyingcheng
     * @date 2020/3/21 14:19
     */
    @Override
    public boolean deleteMember(Integer id) {
        log.info("{}.deleteMember, port:[{}], id:[{}]", this.getClass().getName(), port, id);
        return true;
    }

}
